package com.tanhua.server.interceptors;

import com.tanhua.domain.db.User;

public class UserHolder {
    private static   ThreadLocal<User> TL = new ThreadLocal<>();

    public static void setUser(User user){
        TL.set(user);
    }

    public static User getUser(){
        return TL.get();
    }

    public static Long getUserId(){
        return TL.get().getId();
    }

    public static void removeUserFromThreadLocal(){
        TL.remove();
    }


}
